// 分类数据管理
import { findHeadCategory } from '@/api/home'
const category = {
  namespaced: true,
  state: () => ({
    categoryList: [] // 分类列表
  }),
  mutations: {
    setCategoryList (state, newList) {
      state.categoryList = newList
    }
  },
  actions: {
    async asyncSetList (ctx) {
      // 调用接口
      const res = await findHeadCategory()
      ctx.commit('setCategoryList', res.result)
    }
  }
}
export default category
